/**
 * Created by Juvid on 2017/3/24.
 */
//ES5
var React = require("react");
var {
    Component,
    PropTypes
} = React;  //引用React抽象组件

var ReactNative = require("react-native");
var {
    View,
    Text,
    TouchableHighlight,
} = ReactNative

//ES5
var MyComponent = React.createClass({
    getInitialState: function() {
        return {
            loopsRemaining: this.props.maxLoops,
        };
    },

    getDefaultProps: function() {
        return {
            autoPlay: false,
            maxLoops: 10,
            label:'哈哈哈',
        };
    },
    handleOptionsButtonClick: function(e) {
        // Here, 'this' refers to the component instance.
        this.setState({showOptionsModal: true});
    },
    propTypes: {
        autoPlay: React.PropTypes.bool.isRequired,
        maxLoops: React.PropTypes.number.isRequired,
        posterFrameSrc: React.PropTypes.string.isRequired,
        videoSrc: React.PropTypes.string.isRequired,
    },

    render: function() {
        return (
            <View>
                <TouchableHighlight onPress={this.handleOptionsButtonClick}>
                    <Text>{this.props.label}</Text>
                </TouchableHighlight>
            </View>
        );
    },
});
module.exports = MyComponent;